<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/app.js" type="module"></script>
    <style>
        div {
            border: 1px solid #ccc;
        }
    </style>
    <script>
        console.log(Number.isNaN("a"));
        function init() {
            document.getElementById("div1").addEventListener("click", () => {
                alert("点击了div1");
            }, false);
            document.getElementById("div2").addEventListener("click", () => {
                alert("点击了div2");
                event.stopPropagation();
            }, false);
            document.getElementById("div3").addEventListener("click", () => {
                alert("点击了div3");
            }, false);
        }
        window.addEventListener("load", init, false);

        let arrays = [1, 2, 3, 4, 5, 63, 4, 3, 6, 5, 8, 85];
        //第一种
        for (let i = 0, len = arrays.length; i < len; i++) {
            console.log(arrays[i]);
        }
        //第二种(ES6),建议用这个
        arrays.forEach((item, index, arrays) => {
            console.log(item);
        });
        //第三种(ES5)
        for (index in arrays) {
            console.log(arrays[index]);
        }
        //第四种(ES6)
        for (item of arrays) {
            console.log(item);
        }
    </script>
</head>

<body>
    <div id="div1" style="width:500px;height:500px;">
        <div id="div2" style="width:250px;height:250px;margin: 100px;">
            <div id="div3" style="width:50px;height:50px;margin:100px;cursor: pointer;">
                点击
            </div>
        </div>
    </div>
    <div id="div1">
        我是一个div
        <span id="spanTest"></span>
    </div>
</body>

</html>